<?php
  class Plugins_Startdate extends model {
  
  
  
  function getformadd($productid="")
  {
  

  
  //$echo=1;
  //$properties=array('class'=>'inpAddCtnt w120 clBg5 clBd2 fs03 clTxt2','placeholder'=>'Start Date');
  //$textbox2=new Element_Textbox("", "startdate[]",$properties);
  //$strstartdate=$textbox2->render($echo);
  
  $strstartdate='<input type="text" name="startdate[]" placeholder="Start Date" class="inpAddCtnt w120 clBg5 clBd2 fs03 clTxt2" >';
  
  //$properties=array('class'=>'inpAddCtnt w120 clBg5 clBd2 fs03 clTxt2','placeholder'=>'End Date');
  //$textbox2=new Element_Textbox("", "enddate[]",$properties);
  //$strenddate=$textbox2->render($echo);
  
  $strenddate='<input type="text" name="enddate[]" placeholder="End Date" class="inpAddCtnt w120 clBg5 clBd2 fs03 clTxt2" >';
  
  
//  $str='<div class="classstartdate"> 
//  '.$strstartdate.'   '.$strenddate.'
//  </div>
//  ';
  
  $str='  <fieldset class="pmtPlg classstartdate">
                        <div class="prdPlg fs04 clTxt2">
                            <label>Period</label><br>
                            <div class="inpDate">
                                '.$strstartdate.'
                            </div>
                            <span>to</span>
                            <div class="inpDate">
                                '.$strenddate.'
                            </div>
                        </div>
                    </fieldset>';
  
  $arraydata['form']=addslashes(str_replace(array("\r\n", "\n", "\r"), '', $str));
  //$arraydata['js'][]=pluginjsinfo.'/startdate.js';
  //$arraydata['js'][]=baseinfo.'/js/zebra_datepicker.js';
  
  //$arraydata['css'][]=baseinfo.'/css/zebradatepicker.css';

  
  
      
  
  
  
  return $arraydata;
  
  
  
  
  
  
  
  }
  
  function getformlanding($arraydata)
  {
  if($arraydata['startnewdate']!="00/00/0000")
  {
  $code  = '<div class="ldIt wrpPmtLd">'."";
  $code .= '<div class="wrpPmtLd">'."";
  $code .= '<h2 class="clTxt2 fs04">Period</h2>'."";
  $code .= '<div class="pmtLd">'."";
  $code .= '<span>'.$arraydata['startnewdate'].'</span>'."";
  $code .= '<span class="clTxt2"> to </span>'."";
  $code .= '<span>'.$arraydata['endnewdate'].'</span>'."";
  $code .= '</div>'."";
  $code .= '</div>'."";
  $code .= '</div>';
  }
  
  
  $data['str']=$code;
  $data['target']='firsttarget';
  
  return $data;
  
  
  }
  
   function getplugin($plugreid)
  {
  
 
     $sql="select *,DATE_FORMAT(tb_plugins_startdate.startdate,'%d/%m/%Y') startnewdate,DATE_FORMAT(tb_plugins_startdate.enddate,'%d/%m/%Y') endnewdate from tb_plugins_startdate where plugreid=".$plugreid;
     $arrayplugin=$this->db->db_set_1recordrow($sql);
  
     return $arrayplugin;

  
  
  

  
  }
  function saveplugin($arraydata,$productid,$plugreid)
  {
  if($arraydata['startdate'])
  {
  list($day,$month,$year)=explode("/",$arraydata['startdate']);
  
  $arraydata['startdate']=$year.'-'.$month.'-'.$day;
  
  }
  
  
    if($arraydata['enddate'])
  {
  list($day,$month,$year)=explode("/",$arraydata['enddate']);
  
  $arraydata['enddate']=$year.'-'.$month.'-'.$day;
  
  }
  
  
  $arraydata['productid']=$productid;
  $arraydata['plugreid']=$plugreid;
  $this->db->db_set($arraydata,'tb_plugins_startdate');
  
  }
  
  
  }
?>
